var t = require("../../../@babel/runtime/helpers/interopRequireDefault")(require("../../../@babel/runtime/regenerator")), e = require("../../../@babel/runtime/helpers/asyncToGenerator"), r = getApp();

Component({
    leftList: [],
    rightList: [],
    leftHeight: 0,
    rightHeight: 0,
    properties: {
        showDirectTag: {
            type: Boolean
        }
    },
    data: {},
    methods: {
        bannerOnTap: function(t) {
            var e = t.currentTarget.dataset.data;
            r.bannerOnTap(e);
        },
        initData: function(r, i) {
            var n = this;
            return e(t.default.mark(function e() {
                return t.default.wrap(function(t) {
                    for (;;) switch (t.prev = t.next) {
                      case 0:
                        return n.leftList = [], n.rightList = [], n.leftHeight = 0, n.rightHeight = 0, n.setData({
                            bannerList: r
                        }), r && r.length > 0 && (n.leftHeight += 576), t.next = 8, n.appendProducts(i);

                      case 8:
                      case "end":
                        return t.stop();
                    }
                }, e);
            }))();
        },
        appendProducts: function(r) {
            var i = this;
            return e(t.default.mark(function e() {
                var n, a, s;
                return t.default.wrap(function(t) {
                    for (;;) switch (t.prev = t.next) {
                      case 0:
                        if (r && r.length) for (n = 0; n < r.length; n++) a = r[n], s = a.productPicLong ? 576 : 466, 
                        i.leftHeight <= i.rightHeight ? (i.leftList.push(a), i.leftHeight += s) : (i.rightList.push(a), 
                        i.rightHeight += s);
                        i.setData({
                            leftList: i.leftList,
                            rightList: i.rightList
                        });

                      case 2:
                      case "end":
                        return t.stop();
                    }
                }, e);
            }))();
        }
    }
});